package com.cdsxlc.common.enums;

import com.cdsxlc.common.constant.GeneratorConstant;

public enum Template {
    /**
     * 实体
     */
    ENTITY("entityTemplate.txt", ".java", "entity/"),

    REPOSITORY("repositoryTemplate.txt","Repository.java", "repository/"),

    SERVICE("serviceTemplate.txt","Service.java", "service/"),

    IMPL("serviceImplTemplate.txt","ServiceImpl.java", "service/impl/"),

    CONTROLLER("controllerTemplate.txt","Controller.java", "controller/"),

    VO("voTemplate.txt", "Vo.java", "vo/"),

    DTO("dtoTemplate.txt", "DTO.java", "dto/"),

    SEARCH_TEMPLATE("searchDTOTemplate.txt", "SearchDTO.java", "dto/"),


    ;

    Template(String templateName, String suffix, String targetDirectory){
        this.templateName = templateName;
        this.suffix = suffix;
        this.targetDirectory = targetDirectory;
    }

    private String templateName;

    private String suffix;

    private String targetDirectory;

    private String packagePrefix;

    public String getTemplateName() {
        return templateName;
    }

    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }

    public String getSuffix() {
        return suffix;
    }

    public void setSuffix(String suffix) {
        this.suffix = suffix;
    }

    public String getTargetDirectory() {
        return GeneratorConstant.PACKAGE_PATH + targetDirectory;
    }

    public void setTargetDirectory(String targetDirectory) {
        this.targetDirectory = targetDirectory;
    }

    public String getPackagePrefix() {
        return GeneratorConstant.PACKAGE_PREFIX + this.targetDirectory.replace("/", ".");
    }


}
